package com.kaishengit.service;

import java.util.List;

import com.kaishengit.dao.IdeaDao;
import com.kaishengit.entity.Idea;
import com.kaishengit.entity.IdeaComment;
import com.kaishengit.util.StringUtil;
import com.kaishengit.util.db.Page;

public class IdeaService {
	private IdeaDao dao = new IdeaDao();

	public void saveIdea(String pid, String eid, String title, String content) {
		Idea idea = new Idea();
		idea.setId(StringUtil.getId());
		idea.setTitle(title);
		idea.setContent(content);
		idea.setEmployeeid(eid);
		idea.setProjectid(pid);
		dao.saveIdea(idea);
		
	}

	public Page<Idea> findByPid(int pageNum,String pid) {
		
		return dao.findByPid(pageNum ,pid);
	}

	public com.kaishengit.entity.Idea findById(String id) {
		
		return dao.findById(id);
	}

	public void editIdea(String id, String title, String content) {
		dao.editIdea(id,title,content);
		
	}

	public void delIdea(String id) {
		dao.delIdea(id);
		
	}

	public void saveIdeaComment(String content, String ideaid, String eid) {
		IdeaComment ic = new IdeaComment();
		ic.setId(StringUtil.getId());
		ic.setContent(content);
		ic.setIdeaid(ideaid);
		ic.setEmployeeid(eid);
		dao.saveIdeaComment(ic);
		
	}

	
}
